package com.zd.web.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.zd.service.NovelService;
import com.zd.service.impl.NovelServiceImpl;

/**
 * Servlet implementation class updateVIP
 */
@WebServlet("/updateVIP")
public class updateVIP extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		System.out.println("VIP过来了");
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		String novelId=request.getParameter("novelId");
		String vipBookId=request.getParameter("vipBookId");
		System.out.println(novelId+vipBookId);
		response.setContentType("application/JSON");
		NovelService nl=new NovelServiceImpl();
		int num=nl.updateVIPBook(novelId,vipBookId);
		String jsonString=JSON.toJSONString(num);
		
		PrintWriter out=response.getWriter();
		out.print(jsonString);
		out.flush();
		out.close();
	}

}
